package com.es.controller;

import com.es.entity.CarParkFindRequest;
import com.es.entity.CountVo;
import com.es.entity.NewCarPark;
import com.es.service.SearchService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Copyright
 *
 * @Author WuHuang
 * @Date 2022/5/24
 */
@RestController
@RequestMapping("car/park/")
public class CarParkController {

    @Resource
    private SearchService searchService;

    @PostMapping("save")
    public String save(@RequestBody NewCarPark newCarPark){
        searchService.addNew(newCarPark);
        return "Ok";
    }

    @RequestMapping("find")
    public CountVo<NewCarPark> find(@RequestBody CarParkFindRequest request){

        return searchService.find(request);

    }


}
